home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / pascal / unitxrf.com / FILEXIST.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1991-05-20  |  1.4 KB  |  44 lines

  1. {****************************************************************************}
  2. {*                                                                          *}
  3. {*    UNIT FilExist    (FilExist.pas)                                       *}
  4. {*                                                                          *}
  5. {*    Donated to the Public Domain 5/20/91 by Dan Thomas CIS: 72301,2164    *}
  6. {*                                                                          *}
  7. {*  Purpose:                                                                *}
  8. {*                                                                          *}
  9. {*    To check for a file's presence.                                       *}
  10. {*                                                                          *}
  11. {****************************************************************************}
  12.  
  13.  
  14. UNIT FilExist;
  15.  
  16.  
  17. INTERFACE
  18.  
  19. FUNCTION FILE_EXISTS(file_id : string) : boolean;
  20.  
  21.  
  22. {============================================================================}
  23. IMPLEMENTATION
  24.  
  25. FUNCTION FILE_EXISTS(file_id : string) : boolean;
  26.  
  27. var
  28.   f : file;
  29.  
  30. begin
  31.   assign(f,file_id);
  32.   {$i-} reset(f); {$i+}
  33.   if ioresult = 0 then
  34.     begin
  35.       file_exists := true;
  36.       {$i-} close(f); {$i+}
  37.       if ioresult = 0 then;
  38.     end
  39.   else
  40.     file_exists := false;
  41. end; {file_exists}
  42.  
  43. end.
  44.